package user

import (
	"ginfwk/adapter/base/controller"
	"ginfwk/application/service"
	"ginfwk/infrastructure/helper/ghttp"
	"github.com/gin-gonic/gin"
)

type UserInfo struct {
	controller.BaseController

	service.AppUserService
}

func (u *UserInfo) Init(g *gin.Context) {
	ctx := g.Request.Context()
	u.BaseController.InitContext(ctx)
	u.AppUserService.InitContext(ctx)
}

func (u *UserInfo) GetApiUserInfo(ctx *gin.Context) interface{} {
	u.Init(ctx)

	userId := 5
	userInfo := u.AppUserService.GetUserInfo(userId)
	return ghttp.Success(userInfo)
}

func (u *UserInfo) GetApiUserList(ctx *gin.Context) interface{} {
	u.Init(ctx)

	userIds := []int{1, 2, 3, 4}
	userList := u.AppUserService.GetUserList(userIds)
	return ghttp.Success(userList)
}
